.\" RCSid "$Id: pinterp.1,v 1.7 2009/02/21 00:06:05 greg Exp $"
.TH PINTERP 1 1/24/96 RADIANCE
.SH NAME
pinterp - interpolate/extrapolate view from pictures
.SH SYNOPSIS
.B pinterp
[
view options
][
.B "\-t threshold"
][
.B "\-z zout"
][
.B \-f
.I type
][
.B \-B
][
.B \-a|q
][
.B "\-e exposure"
][
.B \-n
]
.B "pictfile zspec .."
.SH DESCRIPTION
.I Pinterp
interpolates or extrapolates a new view from
one or more RADIANCE pictures and
sends the result to the standard output.
The input picture files must contain correct view specifications, as
maintained by
.I rpict(1),
.I rvu(1),
.I pfilt(1)
and
.I pinterp.
Specifically,
.I pinterp
will not work on pictures processed by
.I pcompos(1)
or
.I pcomb(1).
Each input file must be accompanied by a z specification, which
gives the distance to each pixel in the image.
If
.I zspec
is an existing file, it is assumed to contain a short floating point
number for each pixel, written in scanline order.
This file is usually generated by the
.I \-z
option of
.I rpict(1).
If
.I zspec
is a positive number rather than a file, it will be used as a
constant value for the corresponding image.
This may be useful for certain transformations on "flat" images or
when the viewpoint remains constant.
.PP
The
.I \-n
option specifies that input and output
z distances are along the view direction,
rather than absolute distances to intersection points.
This option is usually appropriate with a constant z
specification, and should not be used with
.I rpict(1)
z files.
.PP
The
.I \-z
option writes out interpolated z values to the specified file.
Normally, this information is thrown away.
.PP
.I Pinterp
rearranges the pixels from the input pictures to produce a
reasonable estimate of the desired view.
Pixels that map within the
.I \-t
threshold of each other (.02 times the z distance
by default) are considered coincident.
With the
.I \-a
option, image points that coincide will be averaged together, giving
a smooth result.
The
.I \-q
option turns averaging off, which means that the first mapped pixel
for a given point will be used.
This makes the program run faster and
take less memory, but at the expense of image quality.
By default, two or more pictures are averaged together, and a single
picture is treated with the faster algorithm.
This may be undesirable when a quick result is desired from multiple
input pictures in the first case, or a single picture is being
reduced in size (anti-aliased) in the second case.
.PP
Portions which were hidden or missing in the input pictures must be
"filled in" somehow, and a number of methods are provided by the
.I \-f
option.
The default value for this option is
.I \-fa,
which results in both foreground and background filling.
The foreground fill algorithm spreads each input pixel to cover all
output pixels within a parallelogram corresponding to that pixel's
projection in the new view.
Without it, each input pixel contributes to at most one output
pixel.
The background algorithm fills in those areas in the final picture
that have not been filled with foreground pixels.
It does this by looking at the boundary surrounding each blank area
and picking the
farthest pixels to each side, assuming that this will make a suitable
background.
The
.I \-ff
option tells the program to use only the foreground fill, the
.I \-fb
option says use only background fill, and the
.I \-f0
option says not to use either fill algorithm.
.PP
Even when both fill algorithms are used, there may still be some unfilled
pixels.
By default, these pixels are painted black and assigned a z distance
of zero.
The
.I \-fc
option can be used to change the color used for unfilled pixels, and
the
.I \-fz
option can be used to set the z distance (always along the view direction).
Alternatively, the
.I \-fr
option can be used to compute these pixels using
.I rtrace(1).
The argument to this option is a quoted string containing arguments
for
.I rtrace.
It must contain the octree used to generate the input
pictures, along with any other options necessary to match the
calculation used for the input pictures.
The
.I \-fs
option can be used to place a limit on the distance (in pixels) over which
the background fill algorithm is used.
The default value for this option is 0, which is interpreted as no limit.
A value of 1 is equivalent to turning background fill off.
When combined with the
.I \-fr
option, this is roughly equivalent to the 
.I \-ps
option of
.I rpict(1).
.PP
In order of increasing quality and cost, one can use the
.I \-fa
option alone, or the
.I \-fr
option paired with
.I \-fs
or
.I \-ff
or
.I \-f0.
The last combination will result in the recalculation of all pixels
not adequately accounted for in the input pictures, with an
associated computational expense.
It is rare that the
.I \-fs
option results in appreciable image degradation, so it is usually
the second combination that is used when the background fill
algorithm results in objectionable artifacts.
.PP
The
.I \-B
option may be used to average multiple views read from the standard
input into a single, blurred output picture.
This is similar to running
.I pinterp
multiple times and averaging the output together with a program like
.I pcomb(1).
This option is useful for simulating motion blur and depth of field.
(See
.I pmdblur(1).)\0
The input views are reported in the information header of the output
file, along with the averaged view.
The picture dimensions computed from the first view will be the
ones used, regardless whether or not the subsequent views agree.
(The reported pixel aspect ratio in the output is determined from
these original dimensions and the averaged view.)\0
Note that the expense of the
.I \-fr
option is proportional to the number of views computed, and the
.I \-z
output file will be the z-buffer of the last view interpolated
rather than an averaged distance map.
.PP
In general,
.I pinterp
performs well when the output view is flanked by two nearby input
views, such as might occur in a walk-through animation sequence.
The algorithms start to break down when there is a large difference
between the view desired and the view(s) provided.
Specifically, obscured objects may appear to have holes in them and
large areas at the image borders may not be filled by the
foreground or background algorithms.
Also, specular reflections and highlights will not be interpolated
very well, since their view-dependent appearance will be
incompletely compensated for by the program.
(The
.I \-a
option offers some benefit in this area.)\0
.PP
The
.I \-e
option may be used to adjust the output image exposure, with the
same specification given as for
.I pfilt.
The actual adjustment will be rounded to the nearest integer f-stop
if the
.I \-q
option is in effect (or there is only a single input picture).
.SH EXAMPLE
To interpolate two frames of a walk-through animation, anti-alias to
512x400 and increase the exposure by 2.5 f-stops:
.IP "" .2i
pinterp \-vf 27.vf \-a \-x 512 \-y 400 \-e +2.5 30.hdr 30.z 20.hdr 20.z > 27.hdr
.PP
To extrapolate a second eyepoint for a stereo pair and recalculate
background regions:
.IP "" .2i
pinterp \-vf right.vf \-ff \-fr "\-av .1 .1 .1 scene.oct" left.hdr left.z > right.hdr
.PP
To convert an angular fisheye to a hemispherical fisheye:
.IP "" .2i
pinterp \-vf fish.hdr \-vth -ff fish.hdr 1 > hemi.hdr
.SH AUTHOR
Greg Ward
.SH "SEE ALSO"
getinfo(1), pdfblur(1), pfilt(1), pmblur(1), pmdblur(1), rpict(1),
ranimate(1), rtrace(1), rvu(1)
